<?php $this->_Hhead()?>
<link href="/Public/Home/public/goods.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/Public/Home/public/jquery.SuperSlide.2.1.1.js"></script>
<script type="text/javascript" src="/Public/Home/public/jquery.lazyload.min.js"></script>
<script type="text/javascript" src="/Public/Home/public/goods.js"></script>
<script type="text/javascript" src="/Public/Home/public/lefttime.js"></script>
<script type="text/javascript" src="/Public/Home/public/uploadPreview.min.js"></script>

<div id="loadinfos">

    <div class="main-box">
        <div class="main-content">
            <div id="ur_here">
                <a href="/index.php">首页</a> <code>&gt;</code>
                <a href="/index.php?C=Index&F=goods_list&type=2&key=<?php echo $goods['f_id']?>">
                    <?php echo $goods['fname']?>
                </a> <code>&gt;</code>
                <?php echo $goods['name']?>
            </div>

            <div class="main-content-left">
                <div class="bd">
                    <!--图片-->
                    <ul style="position: relative; width: 600px; height: 605px;">
                        <?php foreach($goods['img'] as $v){
                        if($v){?>
                        <li style="position: absolute; width: 600px; left: 0px; top: 0px;"><a
                                href="javascript:void(0);">
                            <img src="<?php echo $v?>"></a>
                        </li>
                        <?php }
                        }?>
                    </ul>
                </div>


                <div class="hd">
                    <ul>
                        <li class="on">1</li>
                    </ul>
                </div>


                <a class="prev" href="javascript:void(0)" style="opacity: 0.248512; display: block;"></a>
                <a class="next" href="javascript:void(0)" style="opacity: 0.248512; display: block;"></a>
            </div>

            <div class="main-content-right">
                <h1><?php echo $goods['name']?></h1>

                <p class="goods-info-phone">
                    <?php echo $goods['msg']?>
                </p>

                <div class="select-option" id="option-standard">
                    <h4>规格</h4>
                    <ul>
                        <ul>
                            <?php foreach($goods_g as $v){?>
                            <!--<li class="select-on">-->
                            <li class="guige" sid="<?php echo $v['id']?>" dat="<?php echo $v['gmoney']?>">
                                <a href="javascript:void(0);"><?php echo $v['gname']?></a>
                            </li>
                            <?php }?>
                        </ul>
                    </ul>
                </div>


                <div class="select-num">
                    <h4>数量</h4>
                    <a id="DelNum" class="nu" href="javascript:void(0)">-</a>
                    <input name="number" type="text" id="number" value="1" size="3">
                    <input name="types" type="hidden" id="types" value="1">
                    <input name="cat_id" type="hidden" id="cat_id" value="54">
                    <input name="goods_id" type="hidden" id="goods_id" value="475">
                    <a id="AddNum" class="nu" href="javascript:void(0)">+</a>
                </div>


                <div class="select-buy">
                    <p class="select-buy-price" data-price="￥<?php echo $goods['money']?>" data-makeprice="0">
                        <span>￥<b id="zmoney"><?php echo $goods['money']?></b></span>
                    </p>

                    <a class="buy-btn order">立即购买</a>
                    <a class="buy-btn flow" style="margin-bottom: 20px;">加入购物车</a>
                    <br/>
                    <br/>

                    <a <?php if($type==2){echo "style='color: #ef3d39;'";}?> class="love-btn" type="<?php echo $type?>"
                    id="like" gid="<?php echo $goods['id']?>" href="javascript:void(0);">
                    ♥
                    </a>
                    <p class="love-p">有<span><?php echo $goods['like']?></span>人喜欢</p>
                </div>
            </div>


        </div>
    </div>

    <div class="xlj-prodesc">
        <div class="goods-desc-menu">
            <ul class="hd clearfix">
                <li class="first on"><a>产品详情</a></li>

                <li><a href="#">用户评价<span>(0)</span></a></li>

            </ul>
        </div>

        <div class="xlj-desc-box set-width">


            <div class="xlj-box set-width2">
                <div class="xlj-good-desc">
                    <?php echo htmlspecialchars_decode($goods['txt'])?>
                </div>
            </div>
            <div class="xlj-box set-width1" id="UserEvaluation" style="display: none;">
                <script type="text/javascript" src="/Public/Home/public/jquery.form.min.js"></script>
                <script type="text/javascript" src="/Public/Home/public/productShow.js"></script>
                <div class="bd">
                    <div class="goods-percent-list">
                        <div class="goods-percent">
                            <ul id="AllPercent" class="clearfix ">
                                <li>暂时还没有任何用户评论</li>
                            </ul>
                        </div>

                        <div class="consulting">
                            <form action="http://www.xiaolajiao.com/goods-475.html" method="post" name="consultForm"
                                  id="consultForm" enctype="multipart/form-data">
                                <input name="comment_goodsId" type="hidden" id="comment_goodsId" value="475">
                                <table>
                                    <tbody>
                                    <tr>
                                        <td class="table-left">标签：</td>
                                        <td>
                                            <ul class="user-label">
                                                <li id="CustomLabel" data-sum="0"><i></i>自定义</li>
                                                <li id="CustomSubmit">提交</li>
                                            </ul>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="table-left">图片：</td>
                                        <td>
                                            <ul class="img-list">
                                                <li class="upload-btn" id="oneImgIN">
                                                    <a href="javascript:void(0);" class="file">添加图片<input type="file"
                                                                                                          id="oneImgUp"
                                                                                                          name="uploadImg[]"></a>
                                                </li>
                                                <li id="oneImg" style="display:none;">
                                                    <img id="oneImgShow">
                                                    <div class="del hide"><em value="删除">X</em></div>
                                                </li>
                                                <li class="upload-btn" id="twoImgIN">
                                                    <a href="javascript:void(0);" class="file">添加图片<input type="file"
                                                                                                          id="twoImgUp"
                                                                                                          name="uploadImg[]"></a>
                                                </li>
                                                <li id="twoImg" style="display:none;">
                                                    <img id="twoImgShow">
                                                    <div class="del hide"><em value="删除">X</em></div>
                                                </li>
                                                <li class="upload-btn" id="threeImgIN">
                                                    <a href="javascript:void(0);" class="file">添加图片<input type="file"
                                                                                                          id="threeImgUp"
                                                                                                          name="uploadImg[]"></a>
                                                </li>
                                                <li id="threeImg" style="display:none;">
                                                    <img id="threeImgShow">
                                                    <div class="del hide"><em value="删除">X</em></div>
                                                </li>
                                                <li class="upload-btn" id="fourImgIN">
                                                    <a href="javascript:void(0);" class="file">添加图片<input type="file"
                                                                                                          id="fourImgUp"
                                                                                                          name="uploadImg[]"></a>
                                                </li>
                                                <li id="fourImg" style="display:none;">
                                                    <img id="fourImgShow">
                                                    <div class="del hide"><em value="删除">X</em></div>
                                                </li>
                                                <li class="upload-btn" id="fiveImgIN">
                                                    <a href="javascript:void(0);" class="file">添加图片<input type="file"
                                                                                                          id="fiveImgUp"
                                                                                                          name="uploadImg[]"></a>
                                                </li>
                                                <li id="fiveImg" style="display:none;">
                                                    <img id="fiveImgShow">
                                                    <div class="del hide"><em value="删除">X</em></div>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="table-left">心得：</td>
                                        <td><textarea name="content" id="ConsultContent" maxlength="300"></textarea>
                                        </td>

                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td><input class="submit" type="submit" name="submit" id="ContentSub"
                                                   value="提交评论" data-val="0"></td>
                                    </tr>
                                    </tbody>
                                </table>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="blank"></div>

</div>
<div id="dialog-modal" style="display: none"></div>

<script>
    //    最终价格 = 基本价格*数量+规格加价*数量
    var money = Number("<?php echo $goods['money']?>"); //基本价格--数值类型
    var jiajia = 0;
    var num = 1;
    $(function () {
        var u_id = "<?php echo $_SESSION['Home']['Member']['id']?>"; //用户id
        //加入收藏
        $('#like').bind('click', function () {
            //判断是否登录
            if (!u_id) {
                alert('请登录！');
                location.href = '/index.php?C=Login&F=login';
                return false;
            }
            var g_id = $(this).attr('gid');
            var type = $(this).attr('type'); //type = 1 加入收藏，=2 取消收藏
            $.get("/index.php?C=Index&F=like", {g_id: g_id, type: type, m_id: u_id}, function (abc) {
                alert(abc.msg);
                location.reload();
            }, 'json')
        });

        //点击选择规格触发事件
//        $(this).attr('dat')  ： 规格加价
        $('.guige').bind('click', function () {
            jiajia = Number($(this).attr('dat')); //加价
            num = Number($('#number').val()); //数量
            $('#zmoney').html((money * num + jiajia * num).toFixed(2)); //最终结果
        });

        //改变数量改变价格
        $('.nu').bind('click', function () {
            num = Number($('#number').val()); //数量
            $('#zmoney').html((money * num + jiajia * num).toFixed(2)); //最终结果
        })


        //加入购物车功能
        var g_id = "<?php echo $goods['id']?>"; //商品id

        $('.flow').bind('click', function () {
            //判断是否登录
            if (!u_id) {
                alert('请登录！');
                location.href = '/index.php?C=Login&F=login';
                return false;
            }

            var gg_id = $('.select-on').attr('sid'); //规格id
            if (!gg_id) {
                alert('请选择规格！');
                return false;
            }
            num = Number($('#number').val()); //数量
            $.get("/index.php?C=Index&F=flow", {gg_id: gg_id, g_id: g_id, num: num, u_id: u_id}, function (abc) {
                alert(abc.msg);
            }, 'json');
        })


        //立即购买
        $('.order').bind('click', function () {
            //判断是否登录
            if (!u_id) {
                alert('请登录！');
                location.href = '/index.php?C=Login&F=login';
                return false;
            }

            var gg_id = $('.select-on').attr('sid'); //规格id
            if (!gg_id) {
                alert('请选择规格！');
                return false;
            }
            num = Number($('#number').val()); //数量
            //跳转
            location.href = "/index.php?C=Order&F=ljgm&num=" + num + "&g_id=" + g_id + '&gg_id=' + gg_id;
        })
    })
</script>
<?php $this->_Hfooter()?>